<template>
  <div v-loading.fullscreen.lock="fullscreenLoading">
    <el-row style="margin-left:3px;">
      <el-link type="primary" @click="viewInstock">
        {{
          this.customerTotalPackages == null ? 0 : this.customerTotalPackages
        }}
        件
      </el-link>
    </el-row>
    <el-row style="margin-left:3px;">
      <el-link type="primary" @click="viewInstock">
        {{ this.inStockTotalPackages == null ? 0 : this.inStockTotalPackages }}
        件</el-link
      >
    </el-row>
    <ViewInStockData
      ref="ViewInStockData"
      :subWaybills="subWaybills"
      :Constatvariable="data"
    >
    </ViewInStockData>
  </div>
</template>

<script>
import { ajax } from "@/store/yg/common/utils";
import axios from "axios";
import * as constant from "@/store/yg/common/constant";
import { m } from "@/store/yg/common/local";
import ViewInStockData from "../../../blank/waybill/alledit/components/ViewInStockData";
export default {
  components: {
    ViewInStockData
  },
  props: ["row", "data", "more"],
  data() {
    return {
      customerTotalPackages: 0,
      inStockTotalPackages: 0,
      subWaybills: [],
      fullscreenLoading: false
    };
  },

  methods: {
    viewInstock() {
      var param = {};
      param["id"] = this.data.id;
      this.fullscreenLoading = true;
      ajax("viewInStockData", param).then(
        res => {
          this.fullscreenLoading = false;
          if (res.code != 200) {
            this.$message.error("无入库信息");
          } else {
            this.subWaybills = res.data;
            if (this.subWaybills) {
              this.subWaybills.forEach(element => {
                element.labelUrl = constant.FILE_SERVER + element.labelUrl;
              });
            }
            this.$refs.ViewInStockData.centerDialogVisible = true;
          }
        },
        error => {
          console.log(error);
        }
      );
    }
  },
  mounted() {
    this.customerTotalPackages = this.data["customerTotalPackages"];
    this.inStockTotalPackages = this.data["inStockTotalPackages"];
  }
};
</script>

<style>
.top {
  text-align: center;
}
</style>
